﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Win32;

namespace ReutersForm
{
    public class RegClass
    {
        private static string _strPath;
        private RegistryKey regKey;
        static RegClass()
        {
            _strPath = @"Software\Microsoft\Windows\CurrentVersion\Internet Settings";
        }
        public string StrPath
        {
            get { return _strPath; }
            set
            {
                if (value != null)
                    _strPath = value;
            }
        }
        public bool SetValue(string keyName, string keyValue)
        {
            regKey = Registry.CurrentUser.OpenSubKey(_strPath, true);
            try
            {
                regKey.SetValue(keyName, keyValue);
            }
            catch (Exception e)
            {
                return false;
            }
            regKey.Close();
            return true;
        }
        //public string GetValue(string keyName, string keyValue)
        //{
        //    object key;
        //    try
        //    {
        //        key = regKey.GetValue(keyName, keyValue);
        //    }
        //    catch (Exception e)
        //    {
        //        return null;
        //    }
        //    regKey.Close();
        //    return key.ToString();
        //}
    }
}
